<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<jsp:include page="../../common/jsp/taglibs.jsp"/>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=2.0">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>新增/修改客户信息</title>
    <jsp:include page="../../common/jsp/head.jsp"/>
    <link href="${ctx}css/public.css" rel="stylesheet" type="text/css"/>
    <link type="text/css" href="${ctx}plugins/ztree/zTreeStyle/zTreeStyle.css?version=${version}" rel="stylesheet"/>
    <style>
        .content_wrap {
            position: absolute;
            z-index: 1;
            background: #fff;
            border: 1px solid #ccc;
        }
    </style>
</head>
<body>
<input id="type" type="hidden" value='${type}'/>
<input id="cusId" type="hidden" value='<s:property value="customer.id"/>'>
<form class="layui-form">
    <table class="layui-table">
        <tr>
            <td colspan="2">
                <div class="layui-form-item">
                    <label class="layui-form-label"><em>*</em>客户名称</label>
                    <div class="layui-input-block" style="width: 78%">
                        <input id="name" type="text" lay-verify="verifyCusName" class="layui-input" placeholder="请输入客户名称"
                               value='<s:property value="customer.name"/>' size="40" maxlength="40">
                    </div>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="layui-form-item">
                    <label class="layui-form-label"><em>*</em>手机</label>
                    <div class="layui-input-inline">
                        <input id="contact" type="text" lay-verify="verifyPhone" placeholder="请输入手机号"
                               class="layui-input" onblur="validatePhone();" size="13" maxlength="13"
                               value='<s:property value="customer.contact"/>'
                               onkeyup="this.value=this.value.replace(/\D/g,'')"
                               onafterpaste="this.value=this.value.replace(/\D/g,'')">
                    </div>
                </div>
            </td>
            <td>
                <div class="layui-form-item">
                    <label class="layui-form-label"><em>*</em>级别</label>
                    <div class="layui-input-inline">
                        <input id="levelTemp" type="hidden" value='<s:property value="customer.level"/>'/>
                        <select id="level" lay-verify="verifyLevel">
                            <option value="">请选择</option>
                            <option value="0">普通</option>
                            <option value="1">会员</option>
                        </select>
                    </div>
                </div>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <div class="layui-form-item">
                    <label class="layui-form-label"><em>*</em>地址</label>
                    <div class="layui-input-block" style="width: 78%">
                        <input id="address" type="text" lay-verify="verifyAddress" class="layui-input" placeholder="请输入客户地址"
                               value='<s:property value="customer.address"/>' size="100" maxlength="100">
                    </div>
                </div>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <div class="layui-form-item">
                    <label class="layui-form-label"><em>*</em>负责人</label>
                    <input id="userId" type="hidden" value='<s:property value="customer.chargeId"/>'/>
                    <div id="treeContent" class="layui-input-inline" style="width:67%;">
                        <input id="userSel" lay-verify="verifyCharge" type="text" readonly placeholder="请选择负责人"
                               class="layui-input layui-input layui-unselect">
                        <i class="layui-icon" style="position: absolute;top:9px;right:10px;">&#xe612;</i>
                        <a onclick="clearUser();" class="layui-btn layui-btn-danger btn-default layui-btn-small"
                           style="position: absolute;top:4px;right:-80px;"><i class="layui-icon">
                            &#xe640;</i>清除</a>
                        <div id="menuContent" class="zTreeDemoBackground left content_wrap">
                            <ul id="userTree" class="ztree"></ul>
                        </div>
                    </div>
                </div>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <div class="layui-form-item">
                    <label class="layui-form-label">邮箱</label>
                    <div class="layui-input-block" style="width: 78%">
                        <input id="email" type="text" lay-verify="verifyEmail" class="layui-input"
                               value='<s:property value="customer.email"/>' size="40" maxlength="40">
                    </div>
                </div>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">备注</label>
                    <div class="layui-input-block" style="width: 78%">
                        <textarea id="remark" class="layui-textarea"
                                  onkeyup="if(this.value.length>150) this.value=this.value.substr(0,150)"><s:property
                                value="customer.remark"/></textarea>
                    </div>
                </div>
            </td>
        </tr>
    </table>
    <div class="layui-form-item">
        <div class="layui-input-inline" style="float:right;margin-top:25px;">
            <a style="float: right;" class="layui-btn layui-btn-primary close">取消</a>
            <a id="submit" style="float: right; margin-right: 15px;" class="layui-btn" lay-submit lay-filter="submit">提交</a>
        </div>
    </div>
</form>
</body>
</html>
<script type="text/javascript" src="${ctx}plugins/ztree/jquery.ztree.all-3.5.min.js?version=${version}"></script>
<script type="text/javascript" src="${ctx}js/user/selectUserRadio.js?version=${version}"></script>
<script type="text/javascript" src="${ctx}common/js/closeAndRefresh.js?version=${version}"></script>
<script type="text/javascript" src="${ctx}js/customer/addOrUpdateCustomer.js?version=${version}"></script>